import Vue from 'vue'
import VueRouter from 'vue-router'
import Index from '../views/index/index.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'Index',
    component: Index,
    children: [
      {
        path: "/user",
        name: "User",
        component: () => import("@/views/user/index.vue")
      },
      {
        path: "/login",
        name: "Login",
        meta: {
          title: "登录"
        },
        component: () => import("@/views/account/login.vue")
      },
      {
        path: "/register",
        name: "Register",
        meta: {
          title: "注册"
        },
        component: () => import("@/views/account/register.vue")
      },
      {
        path: "/forget",
        name: "Forget",
        meta: {
          title: "忘记密码"
        },
        component: () => import("@/views/account/forget.vue")
      },
      {
        path: "/safe",
        name: "Safe",
        meta: {
          title: "安全设置"
        },
        component: () => import("@/views/safe/index.vue")
      },
      {
        path: "/password",
        name: "Password",
        meta: {
          title: "重置密码"
        },
        component: () => import("@/views/safe/password.vue")
      },
      {
        path: "/capital",
        name: "Capital",
        meta: {
          title: "设置资金密码"
        },
        component: () => import("../views/safe/capital")
      },
      {
        path: "/bank",
        name: "Bank",
        meta: {
          title: "绑定银行卡"
        },
        component: () => import("../views/safe/bank")
      },
      {
        path: "/bankAdd",
        name: "BankAdd",
        meta: {
          title: "添加银行卡"
        },
        component: () => import("../views/safe/bankAdd")
      },
      {
        path: "/my",
        name: "My",
        meta: {
          title: "我的帐户"
        },
        component: () => import("../views/my/index")
      },
      {
        path: "/authentication",
        name: "Authentication",
        meta: {
          title: "实名认证"
        },
        component: () => import("../views/authentication/index")
      },
      {
        path: "/recharge",
        name: "Recharge",
        meta: {
          title: "充值"
        },
        component: () => import("../views/recharge/index")
      },
      {
        path: "/payStatus",
        name: "PayStatus",
        meta: {
          title: "支付状态"
        },
        component: () => import("../views/pay/status")
      },
      {
        path: "/payResult",
        name: "PayResult",
        meta: {
          title: "支付结果"
        },
        component: () => import("../views/pay/result")
      },
      {
        path: "/order",
        name: "Order",
        meta: {
          title: "租车订单"
        },
        component: () => import("../views/order/index")
      },
      {
        path: "/orderDetailed",
        name: "OrderDetailed",
        meta: {
          title: "订单详情"
        },
        component: () => import("../views/order/detailed")
      },
    ]
  }
]
const originalPush = VueRouter.prototype.push
  VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}
const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
